package com.wzy.mall.web.servlet.client;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/mall/goods/*")
public class GoodsServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String requestURI = request.getRequestURI();
        String action = requestURI.replace("/api/mall/goods/", "");
        if("getGoodsByType".equals(action)) {
            Goods.getGoodsByType(request, response);

        } else if("getGoodsInfo".equals(action)) {
            Goods.getGoodsInfo(request, response);

        } else if("getGoodsComment".equals(action)) {
            Goods.getGoodsComment(request, response);

        } else if("getGoodsMsg".equals(action)) {
            Goods.getGoodsMsg(request, response);

        } else if("askGoodsMsg".equals(action)) {
            Goods.askGoodsMsg(request, response);
        } else if("searchGoods".equals(action)) {
            Goods.searchGoods(request, response);

        }
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
